// JavaScript Document
;(function($){
/*login登录页面*/
	$.fn.yanZheng=function(obj){
		var regUser=/^\w{5,20}$/;
		var regPassword=/^\w{6,18}$/;
		var regTel=/^1[34578]\d{9}$/;
		//var regEmail=/^(\w)+(\.\w+)*@(\w)+((\.\w+)+)$/;
		var userName="";
		var userPassword="";
		var userConfirmPassword="";
		var userTel="";
		//var userEmail="";
		var userCaptcha="";
		var userCaptchaTel="";
		//错误提示背景
		function wrongPoints(elements, values){
			$(elements).css({"background-image":values, "border":"2px solid #ffa943"});
		}
		//得到焦点提示背景
		function focusPoints(elmts, vals){
			$(elmts).css({"background-image":vals, "border":"2px solid transparent"});
		}
		//用户名验证
		$(".lg_zh input").on("blur", function(){
			userName=$(".lg_zh input").val();
			if(regUser.test(userName)){
				//$(".lg_zh input").next().removeClass("lg_pointShow");
				$(this).parent().next().children("input").focus();
			}else{
				wrongPoints(".lg_zh input", "url(../../resources/images/wechat/ico_dlzh.png), url(../../resources/images/wechat/wrong.png)");
				//$(".lg_zh input").next().addClass("lg_pointShow");
			}
		})
		$(".lg_zh input").on("focus", function(){
			focusPoints(".lg_zh input", "url(../../resources/images/wechat/ico_dlzh.png)");
			$(".loginPoint").text("");
			//$(".lg_zh input").next().removeClass("lg_pointShow");
		})
		//密码验证
		$(".lg_ps input").on("blur", function(){
			userPassword=$(".lg_ps input").val();
			if(regPassword.test(userPassword)){
				//$(".lg_ps input").next().removeClass("lg_pointShow");
				$(this).parent().next().children("input").focus();
			}else{
				wrongPoints(".lg_ps input", "url(../../resources/images/wechat/ico_dlmm.png), url(../../resources/images/wechat/wrong.png)");
				//$(".lg_ps input").next().addClass("lg_pointShow");
			}
		})
		$(".lg_ps input").on("focus", function(){
			focusPoints(".lg_ps input", "url(../../resources/images/wechat/ico_dlmm.png)");
			$(".loginPoint").text("");
			//$(".lg_ps input").next().removeClass("lg_pointShow");
		})
		//确认密码
		$(".lg_qrmm input").on("blur", function(){
			userConfirmPassword=$(".lg_qrmm input").val();
			if(userConfirmPassword==userPassword && userConfirmPassword!=""){
				//$(".lg_qrmm input").next().removeClass("lg_pointShow");
				$(this).parent().next().children("input").focus();
			}else{
				wrongPoints(".lg_qrmm input", "url(../../resources/images/wechat/ico_qrmm.png), url(../../resources/images/wechat/wrong.png)");
				//$(".lg_qrmm input").next().addClass("lg_pointShow");
			}
		})
		$(".lg_qrmm input").on("focus", function(){
			focusPoints(".lg_qrmm input", "url(../../resources/images/wechat/ico_qrmm.png)");
			$(".loginPoint").text("");
			//$(".lg_qrmm input").next().removeClass("lg_pointShow");
		})
		/*//邮箱输入
		$(".lg_em input").on("blur", function(){
			userEmail=$(".lg_em input").val();
			if(regEmail.test(userEmail)){
				//$(".lg_em input").next().removeClass("lg_pointShow");
			}else{
				wrongPoints(".lg_em input", "url(../../resources/images/wechat/ic_youxiang.png), url(../../resources/images/wechat/wrong.png)");
				//$(".lg_em input").next().addClass("lg_pointShow");
			}
		})
		$(".lg_em input").on("focus", function(){
			focusPoints(".lg_em input", "url(../../resources/images/wechat/ic_youxiang.png)");
			//$(".lg_em input").next().removeClass("lg_pointShow");
		})*/
		//手机输入
		$(".lg_sr input").on("blur", function(){
			userTel=$(".lg_sr input").val();
			if(regTel.test(userTel)){
				//$(".lg_sr input").next().removeClass("lg_pointShow");
				$(this).parent().next().children("input").focus();
			}else{
				wrongPoints(".lg_sr input", "url(../../resources/images/wechat/ic_shouji.png), url(../../resources/images/wechat/wrong.png)");
				//$(".lg_sr input").next().addClass("lg_pointShow");
			}
		})
		$(".lg_sr input").on("focus", function(){
			focusPoints(".lg_sr input", "url(../../resources/images/wechat/ic_shouji.png)");
			$(".loginPoint").text("");
			//$(".lg_sr input").next().removeClass("lg_pointShow");
		})
		//验证码
		$(".lg_yzm input").on("blur", function(){
			userCaptcha=$(".lg_yzm input").val();
			if(userCaptcha!=""){
				//$(".lg_yzm input").next().removeClass("lg_pointShow");
				$(this).parent().next().children("input").focus();
			}else{
				wrongPoints(".lg_yzm input", "url(../../resources/images/wechat/wrong.png)");
				//$(".lg_yzm input").next().addClass("lg_pointShow");
			}
		})
		$(".lg_yzm input").on("focus", function(){
			focusPoints(".lg_yzm input", "none");
			$(".loginPoint").text("");
			//$(".lg_yzm input").next().removeClass("lg_pointShow");
		})
		//手机验证码
		$(".lg_sjyzm input").on("blur", function(){
			userCaptchaTel=$(".lg_sjyzm input").val();
			if(userCaptchaTel!=""){
				//$(".lg_sjyzm input").next().removeClass("lg_pointShow");
				$(this).parent().next().children("input").focus();
			}else{
				wrongPoints(".lg_sjyzm input", "url(../../resources/images/wechat/wrong.png)");
				//$(".lg_sjyzm input").next().addClass("lg_pointShow");
			}
		})
		$(".lg_sjyzm input").on("focus", function(){
			focusPoints(".lg_sjyzm input", "none");
			$(".loginPoint").text("");
			//$(".lg_sjyzm input").next().removeClass("lg_pointShow");
		})

	}
})(jQuery);
